home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
ddeuti
/
form1.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
6KB
|
216 lines
VERSION 2.00
Begin Form Form1
Caption = "DDE Test Utility"
ClientHeight = 4935
ClientLeft = 1380
ClientTop = 1575
ClientWidth = 7485
Height = 5340
Icon = FORM1.FRX:0000
Left = 1320
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4935
ScaleWidth = 7485
Top = 1230
Width = 7605
Begin CommandButton Command2
Caption = "Cancel"
Height = 495
Left = 120
TabIndex = 12
Top = 4200
Width = 1215
End
Begin CommandButton Command1
Caption = "OK"
Height = 495
Left = 120
TabIndex = 11
Top = 3600
Width = 1215
End
Begin TextBox DDEField
Height = 2295
Left = 1560
MultiLine = -1 'True
TabIndex = 13
Top = 2520
Width = 5775
End
Begin TextBox ddeexecute
Height = 375
Left = 2040
TabIndex = 4
Top = 1680
Width = 2535
End
Begin TextBox ddeitem
Height = 375
Left = 2040
TabIndex = 3
Top = 1320
Width = 2535
End
Begin TextBox ddetopic
Height = 375
Left = 2040
TabIndex = 2
Top = 960
Width = 2535
End
Begin TextBox ddepath
Height = 375
Left = 2040
TabIndex = 1
Top = 600
Width = 2535
End
Begin ListBox List1
Height = 1395
Left = 4800
TabIndex = 5
Top = 480
Width = 2535
End
Begin TextBox ddename
Height = 375
Left = 2040
TabIndex = 0
Top = 240
Width = 2535
End
Begin Label Label6
Caption = "Result"
Height = 255
Left = 4080
TabIndex = 14
Top = 2160
Width = 615
End
Begin Label Label7
Caption = "Execute Command"
Height = 255
Left = 240
TabIndex = 15
Top = 1800
Width = 1695
End
Begin Label Label4
Caption = "Item"
Height = 255
Left = 1440
TabIndex = 9
Top = 1440
Width = 495
End
Begin Label Label3
Caption = "Topic"
Height = 255
Left = 1320
TabIndex = 8
Top = 1080
Width = 495
End
Begin Label Label2
Caption = "Path"
Height = 255
Left = 1440
TabIndex = 7
Top = 720
Width = 495
End
Begin Label Label1
Caption = "Program Name"
Height = 255
Left = 600
TabIndex = 6
Top = 360
Width = 1335
End
Begin Label Label5
Caption = "Shell Mode"
Height = 255
Left = 5040
TabIndex = 10
Top = 240
Width = 1215
End
End
Dim windowstyle(4) As String
Const NONE = 0
Const COLD = 2
Const HOT = 1
Const DDE_NO_APP = 282
Sub Command1_Click ()
Dim appname As String
Dim pathname As String
Dim topic As String
Dim item As String
Dim execute As String
appname = Form1.ddename.Text
pathname = Form1.ddepath.Text
topic = Form1.ddetopic.Text
item = Form1.ddeitem.Text
execute = Form1.ddeexecute.Text
If Len(appname) = 0 Then
MsgBox "You must enter an application name."
Exit Sub
End If
If Len(pathname) = 0 Then
MsgBox "You must enter a pathname."
Exit Sub
End If
If Len(topic) = 0 Then
MsgBox "You must enter a topic."
Exit Sub
End If
If Right$(pathname, 1) <> "\" Then
pathname = pathname + "\"
End If
On Error GoTo loadapp
restart:
Form1.DDEField.LinkMode = NONE
Form1.DDEField.LinkTopic = appname + "|" + topic
Form1.DDEField.LinkItem = item
Form1.DDEField.LinkMode = COLD
Form1.DDEField.LinkRequest
If (Len(execute) > 0) Then
If Left$(execute, 1) <> "[" Then
execute = "[" + execute
End If
If Right$(execute, 1) <> "]" Then
execute = execute + "]"
End If
Form1.DDEField.LinkExecute execute
End If
Exit Sub
loadapp:
If Err = DDE_NO_APP Then
t% = Shell(pathname + appname, Val(windowstyle(Form1.List1.ListIndex)))
GoTo restart
Else
MsgBox "Error :" + Str$(Err)
End
End If
End Sub
Sub Command2_Click ()
End
End Sub
Sub Form_Load ()
Dim i As Integer
windowstyle(0) = "1 - Normal with Focus"
windowstyle(1) = "2 - Minimized with Focus"
windowstyle(2) = "3 - Maximized with Focus"
windowstyle(3) = "4 - Normal without Focus"
windowstyle(4) = "7 - Minimized without Focus"
For i = 0 To 4
Form1.List1.AddItem windowstyle(i)
Next
Form1.List1.ListIndex = 4
End Sub